<template>
  <div class="withdrawal">
      <div class="box">
        <div class="btn">
                <el-form  :inline="true"  :model="params" size="small"  label-width="100px" >
                    <el-form-item label="提现人:">
                        <el-input  v-model="params.name" placeholder="输入姓名"  clearable @clear="search"/> 
                    </el-form-item>
                    <el-form-item label="状态:">
                        <el-select v-model="params.status" placeholder="请选择状态" clearable filterable @change="search">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select> 
                    </el-form-item>
                    <el-form-item label="审批时间段:">
                        <el-date-picker
                            v-model="time"
                            type="datetimerange"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            value-format="yyyy-MM-dd HH:mm"
                            @change="change1">
                        </el-date-picker>
                    </el-form-item>
                    <span style="margin-left:10px">
                        <el-button type="primary" icon="el-icon-search" size="small" @click="search">搜索</el-button>
                    </span>
                </el-form>
            </div>
          <el-card>
            <el-table :data="tableData" border style="width: 100%" >
                <el-table-column  label="序号" align="center" type="index" width="50"> </el-table-column>
                <el-table-column prop="name" label="提现人" align="center" width="180"> </el-table-column>
                <el-table-column prop="phone" label="联系方式" align="center" width="120"> </el-table-column>
                <el-table-column prop="price" label="提现金额(元)" align="center" width="120"> </el-table-column>
                <el-table-column prop="status" label="状态" align="center" width="100px">
                  <template slot-scope="scope">
                        <!-- {{scope.row.status ==2?'待打款':scope.row.status ==3?'已打款':"已拒绝"}} -->
                        <el-tag type="success" v-if="scope.row.status == 3">已打款</el-tag>
                        <el-tag type="danger" v-if="scope.row.status == 0">已拒绝</el-tag>
                        <el-tag  v-if="scope.row.status == 2">待打款</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="servicePrice" label="手续费(元)" align="center" width="120"> </el-table-column>
                <el-table-column prop="userName" label="打款审核人" align="center" :show-overflow-tooltip="true" width="180"> </el-table-column>
                <!-- <el-table-column prop="paymentOrderSn" label="打款订单号" align="center" :show-overflow-tooltip="true"> </el-table-column> -->
                <el-table-column prop="createTime" label="申请时间" align="center" width="180"> </el-table-column>
                <el-table-column prop="adoptTime" label="申批时间" align="center" width="180"> </el-table-column>
                <el-table-column prop="payTime" label="打款时间" align="center" width="180"> </el-table-column>
                <el-table-column prop="content" label="备注" align="center" :show-overflow-tooltip="true" width="240"> </el-table-column>
                <!-- <el-table-column  label="操作" align="center" fixed="right" width="200">
                    <template slot-scope="scope">
                         <el-button @click="handlePayClick(scope.row)" type="primary" size="small" icon="el-icon-check" plain>打 款</el-button>
                    </template>
                </el-table-column> -->
            </el-table>
        </el-card>
      </div>
      <pagination
        v-show="newsTotal > 0"
        :total="newsTotal"
        :page.sync="params.pageNum"
        :limit.sync="params.pageSize"
        @pagination="getInformationList"
      />
  <!-- <el-dialog
  title="上传材料"
  :visible.sync="dialogVisible"
  width="35%"
  :before-close="handleClose">
<el-form  label-width="120px" :model="form"  >
  <el-form-item label="图片:" prop="coverPicture">
        <el-upload
        :headers='headers'
        class="avatar-uploader"
        :action="upImage+'/table/upload'"
        :on-success="handleAvatarSuccess"
        :show-file-list="false"
        >
        <img v-if="form.paymentPic" :src="form.paymentPic" class="avatar" />
        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
    </el-form-item>
    <el-form-item label="备注" prop="paymentRemark">
          <el-input v-model="form.paymentRemark" type="textarea" ></el-input>
    </el-form-item>
</el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="onSubmit">确 定</el-button>
  </span>
</el-dialog> -->
  </div>
</template>

<script>
import {getList,payMent,getExamine,getDsc} from '@/api/finance/index';
import { getToken } from "@/utils/auth";

export default {
  name: '',
  data () {
    return {
        tableData:[],
        loading:false,
        dialogVisible:false,
        time:"",
        headers: { Authorization: "Bearer " + getToken() },
        upImage: process.env.VUE_APP_BASE_API,
        params:{
            pageNum: 1,
            pageSize: 10,
            status:undefined,
            payTime:'',
            adoptTime:'',
        },
        queryParams:{
          pageNum: 1,
          pageSize: 10,
          status:4,
        },
        newsTotal:0,
        paramsFlag:0,
        options:[{
          value: 0,
          label: '已拒绝'
        },{
          value: 2,
          label: '待打款'
        }, {
          value: 3,
          label: '已打款'
        },],
        form:{},
    }
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  methods: {
    change1(val){
        //   console.log(val);
          if(val == null){
              this.params.adoptTime = ''
              this.params.payTime = ''
          }
      },
    // onSubmit(){
    //   // console.log(this.form);
    //   payMent(this.form).then(res =>{
    //     if(res.code == 200){
    //       // console.log(res);
    //       this.dialogVisible = false
    //       this.$message.success('已申请打款')
    //     }
    //   })
    // },
    // handlePayClick(row){
    //   this.form = row
    //   this.dialogVisible =true
    // },
    handleClose(){
      this.dialogVisible = false
    },
    // handleAvatarSuccess(res, file) {
    //   // console.log(URL.createObjectURL(file.raw));
    //   this.form.paymentPic ='https://9001rzsxy.oss-cn-beijing.aliyuncs.com'+  res.data
    //     if(res.code ==200){
    //      this.$message.success("上传成功");
    //     }
    // },
     // 搜索
    search(){
      if(this.time != null){
        this.params.adoptTime = this.time[0]
        this.params.payTime = this.time[1]
      }
      this.$set(this.params, "pageNum", 1);
      this.paramsFlag = 0;
      this.tableData = []
      this.getSearchList();
    },
    getSearchList(){
      this.loading = true;
      getList(this.params).then(res => {
        this.tableData = res.rows
        this.newsTotal = res.total
        this.loading = false;
      });
    },
      
    getInformationList() {
      this.loading = true;
      getList(this.params).then(res => {
        this.tableData = res.rows
        this.newsTotal = res.total
        this.loading = false;
      });
    },
  },
  created () {
    this.getInformationList()
  },
  mounted () {}
}
</script>

<style rel="stylesheet/scss" lang="scss">
.box{
    margin: 10px;
    .btn{
        margin-top: 20px;
    }
}
.avatar-uploader .el-upload {
  width: 148px;
  height: 148px;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #20a0ff;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 148px;
  height: 148px;
  line-height: 148px;
  text-align: center;
  border: 1px dashed #ccc;
}

.avatar {
  width: 148px;
  height: 148px;
  display: block;
}
</style>
